package com.dhl.fin.api.domain;

import com.dhl.fin.api.common.annotation.Excel;
import com.dhl.fin.api.common.annotation.ExcelTitle;
import com.dhl.fin.api.common.domain.BasicDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;

/**
 * @author CuiJianbo
 * @since 2025/3/15
 */

/**
 * 存定期
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Excel
@Table(name = "t_fix_deposit")
public class FixDeposit extends BasicDomain {

    @ExcelTitle(name = "存入金额（元）", width = 15, sort = 1)
    @Column(columnDefinition = "decimal(10,2)")
    private Double moneyAmount;

    @ExcelTitle(name = "期限（年）", width = 15, sort = 2)
    private Integer years;

    @Column(columnDefinition = "date")
    private Date startDate;


    @Column(columnDefinition = "date")
    private Date endDate;

    @ExcelTitle(name = "年化利率（%）", width = 15, sort = 3)
    @Column(columnDefinition = "decimal(10,2)")
    private Double yearRate;

    @ExcelTitle(name = "总利息（元）", width = 15, sort = 4)
    @Column(columnDefinition = "decimal(10,2)")
    private Double totalInterest;

    @ExcelTitle(name = "办理人", width = 15, sort = 6)
    @Column(columnDefinition = "varchar(15)")
    private String operator;

    @ExcelTitle(name = "备注", width = 25, sort = 9)
    @Column(columnDefinition = "varchar(200)")
    private String remark;

    @ExcelTitle(name = "标签", width = 25, sort = 8)
    @Column(columnDefinition = "varchar(50)")
    private String tag;

    /**
     * 1:已完成  0：未完成
     */
    @Column(columnDefinition = "bit(1)")
    private Integer finished;

    @ManyToOne
    @JoinColumn(name = "bank_account_id")
    private BankAccount bankAccount;

    @Transient
    @ExcelTitle(name = "开始时间", width = 15, sort = 4)
    private String endDateStr;

    @Transient
    @ExcelTitle(name = "结束时间", width = 15, sort = 5)
    private String startDateStr;

    @Transient
    @ExcelTitle(name = "办理时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 20, sort = 7)
    private String createTimeStr;

}
